package cn.stylefeng.guns.core.enums;

import cn.stylefeng.guns.core.exception.enums.abs.AbstractBaseExceptionEnum;

/**
 * @author a
 * @date 2021/11/1 19:34
 */


public enum CoreExceptionEnum implements AbstractBaseExceptionEnum {

    /**
     * 物流字典
     */
    BRANCH_REPEAT("网点重复"),
    TEANT_ADMIND_ERROR("租户管理员角色不可修改!"),



    //-----------------------------------------
    WRITE_ERROR( "渲染界面错误"),
    ERROR_PARAM("参数错误"),
    ERROR_DATA("数据错误"),
    RESOURCES_NOT_EXIST("资源不存在"),
    IO_ERROR("流读取异常"),
    SERVICE_ERROR( "服务器异常"),
    PWD_ERROR( "密码错误"),
    ACCOUNT_NOT_EXIST( "账号不存在"),
    ACCOUNT_DISABLE( "账号被冻结"),
    BOOK_ERROR( "书籍已发放"),
    ACCOUNT_HAS_EXIST( "账号已存在"),
    NO_DICTIONARIES( "未配置字典值"),
    DICTIONARIES_ERROR( "字典值格式错误"),
    BASE_CONFIG("基础配置项,不可删除"),
    ERROR_PERMISSION("无权限操作"),
    ORDER_NO_EXIST("订单不存在"),

    PRICE_ZERO(210, "支付金额为零"),
    BALANCE_INSUFFICIENT (220, "余额不足"),

    INVLIDE_DATE_STRING(400, "输入日期格式不对"),
    FILE_READING_ERROR(400, "FILE_READING_ERROR!"),
    FILE_NOT_FOUND(400, "FILE_NOT_FOUND!"),
    PAGE_NULL(404, "请求页面不存在"),
    REMOTE_SERVICE_NULL(404, "远程服务不存在"),


    ERROR_TOKEN(520,"token异常"),
    NO_PWD(540, "密码为空"),
    UPDATE_DATA(570, "数据更新错误"),
    INSERT_DATA(580, "数据保存错误"),
    ERROR_DICT_LACK(590,"字典表配置缺失"),


    ENCRYPT_ERROR(600, "加解密错误"),


    NO_CURRENT_USER(700, "当前没有登录的用户"),
    FIELD_VALIDATE_ERROR(700, "数据库字段与实体字段不一致!"),
    INIT_TABLE_EMPTY_PARAMS(701, "初始化数据库，存在为空的字段"),

    ORDER_CHANGE_STAGE_ERROR("当前订单不可进行回退"),


    ASYNC_ERROR(5000, "数据在被别人修改，请稍后重试"),
    BANNER_ERROR("不可以修改平台的轮播图"),
    ;



    private Integer code;
    private String message;

    private CoreExceptionEnum(int code, String message) {
        this.code = code;
        this.message = message;
    }

    private CoreExceptionEnum(String message) {
        this.code = 500;
        this.message = message;
    }

    @Override
    public Integer getCode() {
        return this.code;
    }

    @Override
    public String getMessage() {
        return this.message;
    }
}
